class Solution {
public:
    int maxArea(vector<int>& height) {
        int left ,right;
        left = 0;
        right = height.size()-1;
        int maxv = -1;
        while(left<right)
        {
            int v = min(height[right],height[left]);
            maxv = max(maxv,v*(right-left));
            if(height[right]>height[left])
            left++;
            else right--;
        }
        return maxv;
    }
};
